<template>
  <footer class="footer">
    <span class="todo-count">剩余<strong>{{list.length}}</strong></span>
    <ul class="filters">
      <li>
        <a :class="{selected: condition === 'all'}" href="javascript:;" @click="changeFn('all')">全部</a>
      </li>
      <li>
        <a :class="{selected: condition === 'incompleted'}" href="javascript:;" @click="changeFn('incompleted')">未完成</a>
      </li>
      <li>
        <a :class="{selected: condition === 'completed'}" href="javascript:;" @click="changeFn('completed')">已完成</a>
      </li>
    </ul>
    <button class="clear-completed" @click="$emit('clearCompleted')">清除已完成</button>
  </footer>
</template>

<script>
export default {
  props: ['list'],
  data(){
    return {
      condition: 'all'
    }
  },
  methods: {
    changeFn(str){
      this.condition = str;
      this.$emit("changeCondition", this.condition)
    }
  }
  
}
</script>

<style>

</style>